home *** CD-ROM | disk | FTP | other *** search
- /*
- change the time calibration factors of all files specified
- Abbreviation comes from
- Late is Better than Never
- */
- #include <stdio.h>
- #include <math.h>
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- int n,i,m,fd;
- unsigned char a1,a2,a3,a4;
- float tica;
- union fourbytes {
- float real;
- long int sig;
- unsigned long int card;
- } b4;
-
- if(argc<3) { /* print help message */
- printf("changing the time calibration factors of all spectra specified\n");
- printf("Abbreviation stands for: Late is Better than Never\n");
- printf("Call like\nlbn 0.03456 *.err *.spc\n");
- }
-
- tica=(float)atof(argv[1]);
-
- b4.real=tica; m=b4.card;
- a1 = m / 16777216 ;
- m = m - (a1 * 16777216);
- a2 = m / 65536;
- m = m - (a2 * 65536);
- a3 = m / 256;
- m = m - (a3 * 256);
- a4 = m ;
- for(n = 2 ; n < argc ; n++) {
- fd=open(argv[n],1,0666);
- printf("touching %s fd= %d , tica = %f\n",argv[n],fd,tica);
- lseek(fd,84L,0);
- write(fd,&a1,1); write(fd,&a2,1);
- write(fd,&a3,1); write(fd,&a4,1);
- lseek(fd,0L,1);
- close(fd);
- }
- exit(0);
- }
-